# -*- coding: utf-8 -*-

# Scrapy settings for panjuewenshu project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     http://doc.scrapy.org/en/latest/topics/settings.html
#     http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
#     http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html

BOT_NAME = 'panjuewenshu'

SPIDER_MODULES = ['panjuewenshu.spiders']
NEWSPIDER_MODULE = 'panjuewenshu.spiders'


CONCURRENT_REQUESTS_PER_DOMAIN = 5
DOWNLOAD_DELAY=2
DOWNLOAD_TIMEOUT = 300
USE_PROXY = True

DOWNLOADER_MIDDLEWARES = {
    'panjuewenshu.middlewares.random_proxy.RandomProxy' : 100
    #'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware' : None,
    #'bbs_crawler.middlewares.rotate_useragent.RotateUserAgentMiddleware' : 400
}


PROXY_IPS = [
    'http://10.103.32.121:3128',
    'http://10.103.32.121:3129',
    'http://10.103.32.121:3130',
    'http://10.103.32.121:3131',
    'http://10.103.32.121:3132',
    'http://10.103.32.122:3128',
    'http://10.103.32.122:3129',
    'http://10.103.32.122:3130',
    'http://10.103.32.122:3131',
    'http://10.103.32.122:3132',
    'http://10.103.32.123:3128',
    #'http://10.103.32.123:3129',
    #'http://10.103.32.123:3130',
    #'http://10.103.32.123:3131',
    #'http://10.103.32.123:3132',
    'http://10.103.32.124:3128',
    'http://10.103.32.124:3129',
    'http://10.103.32.124:3130',
    'http://10.103.32.124:3131',
    'http://10.103.32.124:3132',
    'http://10.103.17.86:3128',
    'http://10.103.17.86:3129',
    'http://10.103.17.86:3130',
    'http://10.103.17.86:3131',
    'http://10.103.17.86:3132',
    'http://10.103.17.86:3133',
    'http://10.103.17.86:3134',
    'http://10.103.17.86:3135',
    'http://10.103.17.86:3136',
    'http://10.103.17.86:3137',
    'http://10.103.17.86:3138',
    'http://10.103.17.86:3139',
    'http://10.103.17.86:3140',
    'http://10.103.17.86:3141',
    'http://10.103.17.86:3142',
    'http://10.103.17.86:3143',
    'http://10.103.17.86:3144',
    'http://10.103.17.86:3145',
    'http://10.103.17.86:3146',
    'http://10.103.17.86:3147',
    'http://10.103.17.86:3148',
    'http://10.103.17.86:3149',
    'http://10.103.17.86:3150',
    #'http://10.103.17.86:3151',
    'http://10.103.17.86:3152',
    'http://10.103.17.86:3153',
    'http://10.103.17.86:3154',
    'http://10.103.17.86:3155',
    'http://10.103.17.86:3156',
    'http://10.103.17.86:3157',
    'http://10.103.17.86:3158',
    'http://10.103.17.86:3159',
    'http://10.103.17.86:3160',
    'http://10.103.17.86:3161',
    'http://10.103.17.86:3162',
    'http://10.103.17.86:3163',
    'http://10.103.17.86:3164',
    'http://10.103.17.86:3165',
    'http://10.103.17.86:3166',
    'http://10.103.17.86:3168',
    'http://10.103.17.87:3128',
    'http://10.103.17.87:3130',
    'http://10.103.17.87:3131',
    'http://10.103.17.87:3132',
    'http://10.103.17.87:3133',
    'http://10.103.17.87:3134',
    'http://10.103.17.87:3135',
    'http://10.103.17.87:3136',
    'http://10.103.17.87:3137',
    'http://10.103.17.87:3138',
    'http://10.103.17.87:3139',
    'http://10.103.17.87:3140',
    'http://10.103.17.87:3141',
    'http://10.103.17.87:3142',
    'http://10.103.17.87:3143',
    'http://10.103.17.87:3144',
    'http://10.103.17.87:3145',
    'http://10.103.17.87:3146',
    'http://10.103.17.87:3147',
    'http://10.103.17.87:3148',
    'http://10.103.17.87:3149',
    'http://10.103.17.87:3150',
    'http://10.103.17.87:3151',
    'http://10.103.17.87:3152',
    'http://10.103.17.87:3153',
    'http://10.103.17.87:3154',
    'http://10.103.17.87:3155',
    'http://10.103.17.87:3156',
    'http://10.103.17.87:3157',
    'http://10.103.17.87:3158',
    'http://10.103.17.87:3159',
    'http://10.103.17.87:3160',
    'http://10.103.17.87:3161',
    'http://10.103.17.87:3162',
    'http://10.103.17.87:3163',
    'http://10.103.17.87:3164',
    'http://10.103.17.87:3165',
    'http://10.103.17.87:3166',
    'http://10.103.17.87:3167',
    'http://10.103.17.87:3168'
]

# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'panjuewenshu (+http://www.yourdomain.com)'

# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS=32

# Configure a delay for requests for the same website (default: 0)
# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY=3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN=16
#CONCURRENT_REQUESTS_PER_IP=16

# Disable cookies (enabled by default)
#COOKIES_ENABLED=False

# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED=False

# Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
#   'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
#   'Accept-Language': 'en',
#}

# Enable or disable spider middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
#    'panjuewenshu.middlewares.MyCustomSpiderMiddleware': 543,
#}

# Enable or disable downloader middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
#    'panjuewenshu.middlewares.MyCustomDownloaderMiddleware': 543,
#}

# Enable or disable extensions
# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
#EXTENSIONS = {
#    'scrapy.telnet.TelnetConsole': None,
#}

# Configure item pipelines
# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
#ITEM_PIPELINES = {
#    'panjuewenshu.pipelines.SomePipeline': 300,
#}

# Enable and configure the AutoThrottle extension (disabled by default)
# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
# NOTE: AutoThrottle will honour the standard settings for concurrency and delay
#AUTOTHROTTLE_ENABLED=True
# The initial download delay
#AUTOTHROTTLE_START_DELAY=5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY=60
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG=False

# Enable and configure HTTP caching (disabled by default)
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED=True
#HTTPCACHE_EXPIRATION_SECS=0
#HTTPCACHE_DIR='httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES=[]
#HTTPCACHE_STORAGE='scrapy.extensions.httpcache.FilesystemCacheStorage'
